package c.e.a.b.e.c;

import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;

/* compiled from: com.google.android.gms:play-services-measurement-base@@18.0.0 */
public final class e7 {
    public static final e7 f = new e7(0, new int[0], new Object[0], false);
    public int a;
    public int[] b;
    public Object[] c;
    public int d;
    public boolean e;

    public e7() {
        this(0, new int[8], new Object[8], true);
    }

    public static void b(int i, Object obj, x7 x7Var) throws IOException {
        int i2 = i >>> 3;
        i &= 7;
        if (i == 0) {
            ((g4) x7Var).a.g(i2, ((Long) obj).longValue());
        } else if (i == 1) {
            ((g4) x7Var).a.z(i2, ((Long) obj).longValue());
        } else if (i == 2) {
            ((g4) x7Var).a.h(i2, (t3) obj);
        } else if (i == 3) {
            g4 g4Var = (g4) x7Var;
            g4Var.a.f(i2, 3);
            ((e7) obj).d(x7Var);
            g4Var.a.f(i2, 4);
        } else if (i == 5) {
            ((g4) x7Var).a.G(i2, ((Integer) obj).intValue());
        } else {
            int i3 = e5.a;
            throw new RuntimeException(new d5("Protocol message tag had invalid wire type."));
        }
    }

    public static e7 c() {
        return new e7(0, new int[8], new Object[8], true);
    }

    public final void a(int i, Object obj) {
        if (this.e) {
            int i2 = this.a;
            int[] iArr = this.b;
            if (i2 == iArr.length) {
                i2 += i2 < 4 ? 8 : i2 >> 1;
                this.b = Arrays.copyOf(iArr, i2);
                this.c = Arrays.copyOf(this.c, i2);
            }
            int[] iArr2 = this.b;
            int i3 = this.a;
            iArr2[i3] = i;
            this.c[i3] = obj;
            this.a = i3 + 1;
            return;
        }
        throw new UnsupportedOperationException();
    }

    public final void d(x7 x7Var) throws IOException {
        if (this.a != 0) {
            Objects.requireNonNull(x7Var);
            for (int i = 0; i < this.a; i++) {
                b(this.b[i], this.c[i], x7Var);
            }
        }
    }

    public final int e() {
        int i = this.d;
        if (i != -1) {
            return i;
        }
        int i2 = 0;
        for (i = 0; i < this.a; i++) {
            int i3 = this.b[i];
            int i4 = i3 >>> 3;
            i3 &= 7;
            if (i3 == 0) {
                i3 = e4.E(i4, ((Long) this.c[i]).longValue());
            } else if (i3 == 1) {
                ((Long) this.c[i]).longValue();
                i3 = e4.N(i4);
            } else if (i3 == 2) {
                i3 = e4.w(i4, (t3) this.c[i]);
            } else if (i3 == 3) {
                i2 = (((e7) this.c[i]).e() + (e4.D(i4) << 1)) + i2;
            } else if (i3 == 5) {
                ((Integer) this.c[i]).intValue();
                i3 = e4.S(i4);
            } else {
                i2 = e5.a;
                throw new IllegalStateException(new d5("Protocol message tag had invalid wire type."));
            }
            i2 = i3 + i2;
        }
        this.d = i2;
        return i2;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof e7)) {
            return false;
        }
        e7 e7Var = (e7) obj;
        int i = this.a;
        if (i == e7Var.a) {
            Object obj2;
            int[] iArr = this.b;
            int[] iArr2 = e7Var.b;
            for (int i2 = 0; i2 < i; i2++) {
                if (iArr[i2] != iArr2[i2]) {
                    obj2 = null;
                    break;
                }
            }
            obj2 = 1;
            if (obj2 != null) {
                Object[] objArr = this.c;
                Object[] objArr2 = e7Var.c;
                int i3 = this.a;
                for (int i4 = 0; i4 < i3; i4++) {
                    if (!objArr[i4].equals(objArr2[i4])) {
                        obj = null;
                        break;
                    }
                }
                obj = 1;
                return obj != null;
            }
        }
    }

    public final int hashCode() {
        int i = this.a;
        int i2 = (i + 527) * 31;
        int[] iArr = this.b;
        int i3 = 17;
        int i4 = 17;
        for (int i5 = 0; i5 < i; i5++) {
            i4 = (i4 * 31) + iArr[i5];
        }
        i2 = (i2 + i4) * 31;
        Object[] objArr = this.c;
        for (int i6 = 0; i6 < this.a; i6++) {
            i3 = (i3 * 31) + objArr[i6].hashCode();
        }
        return i2 + i3;
    }

    public e7(int i, int[] iArr, Object[] objArr, boolean z) {
        this.d = -1;
        this.a = i;
        this.b = iArr;
        this.c = objArr;
        this.e = z;
    }
}
